VPATH = src
CC = g++
CXXFLAG = --std=c++11 -I headers -Ofast
HEADERS = $(wildcard headers/*.h)
LIBS = -lsfml-graphics -lsfml-window -lsfml-system
OBJ = diamondsquare.o \
      markovNames.o \
      landMap.o \
      lightingGenerator.o \
      perlinNoise.o \
      normalizer.o \
      fractalNoise.o \
      windMap.o \
      heatMap.o \
      islandHeightmapGenerator.o \
      waterGenerator.o \
      river.o \
      groundWaterMap.o \
      biomeGenerator.o \
      renderedMap.o
FRONTEND_OBJ = main.o \
               sfmlFrontend.o \
               mapDisplay.o
GUI_OBJ = gui.o \
          guiFrontend.o \
          button.o \
          textBox.o \
          progressWindow.o
TEST_OBJ = tester.o
EXEC = pws

all : pws test gui

src/landMap.o: src/landMap.cpp
	$(CC) -c src/landMap.cpp -o landMap.o --std=c++11 -I headers -O2

%.o : %.cpp
	$(CC) -c $< -o $@ $(CXXFLAG)

pws : $(FRONTEND_OBJ) $(OBJ) $(HEADERS)
	$(CC) -o $(EXEC) $(FRONTEND_OBJ) $(OBJ) $(LIBS)

test : $(TEST_OBJ) $(OBJ) $(HEADERS)
	$(CC) -o test $(TEST_OBJ) $(OBJ) $(LIBS)

gui : $(GUI_OBJ) $(OBJ) $(HEADERS)
	$(CC) -o guipig $(GUI_OBJ) $(OBJ) $(LIBS)

.PHONY : clean
clean :
	rm $(EXEC) test guipig $(OBJ) $(FRONTEND_OBJ) $(TEST_OBJ) $(GUI_OBJ)
